def use_generator_calculate_avager():
    total = 0
    average = 0
    count = 0

    while True:
        value = yield average
        if value is None:
            return "传过来的值不能为None"
        else:
            total = total + value
            count += 1
            average = total / count


# 初始化生成器，函数并未执行
average_gen = use_generator_calculate_avager()

print("第一次的没有输入，返回的平均值为:", next(average_gen))

print("输入第1个值日10,平均值为=", average_gen.send(10))
print("输入第2个值日10,平均值为=", average_gen.send(11))
print("输入第3个值日10,平均值为=", average_gen.send(12))
print("输入第4个值日10,平均值为=", average_gen.send(13))
